/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clases;

import com.sun.rowset.internal.Row;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author a
 */


public class TableModel extends AbstractTableModel {

    private String[] columnNames ;
    private Object[][] data;
    private List<?> lista;
    
    public TableModel(String [] columna, List<?> lis,Object[][] datos)
    {
        columnNames  = columna;
        lista=lis;
        data=datos;
        
    }
    
    @Override
    public int getRowCount() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return data.length;
        
    }

    @Override
    public int getColumnCount() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return columnNames .length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return data[rowIndex][columnIndex];
    }
    
    public Object getValueAt(int rowIndex) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return lista.get(rowIndex);
    }
    
}
